package pl.smath.expression.model.presentation;

import pl.smath.expression.model.NumberTerm;
import pl.smath.expression.model.Term;
import pl.smath.expression.model.VariableTerm;

public class AbsoluteTerm extends PresentationTerm {

	private Term innerTerm;
	
	public AbsoluteTerm(Term innerTerm) {
		super("");
		this.innerTerm = innerTerm;
	}
	
	public Term getInnerTerm() {
		return innerTerm;
	}
	
	/**
	 * Sprawdzenie czy 2 wartości bezwgledne wyrazenia sa sobie równowazne.
	 */
	public boolean isAbsTheSame(Term term){
		if (!(term instanceof AbsoluteTerm))
			return false;
		
		return innerTerm.isAbsTheSame(((AbsoluteTerm)term).getInnerTerm());
	}
	

	public String toString(){
		String output = "";
		
		if(isNegative())
			output = "-";
		
		output += "|" + innerTerm.toString() + "|";
		
		return output;
		
	}

}
